﻿using System;
using System.Diagnostics;

namespace CSharpLearning.EventViewer
{
    public class EventViewerHelper
    {
        public void WriteToEventViewer()
        {
            EventLog elLog = new System.Diagnostics.EventLog("Application", Environment.MachineName, "DemoEventSource");
            elLog.WriteEntry("This is a information message", EventLogEntryType.Information);
            elLog.WriteEntry("This is a warning message", EventLogEntryType.Warning);
            elLog.WriteEntry("This is a Error message", EventLogEntryType.Error);
            elLog.WriteEntry("This is a Success Audit message", EventLogEntryType.SuccessAudit);
            elLog.WriteEntry("This is a Failed Audit message", EventLogEntryType.FailureAudit);
            elLog.Dispose();
        }
    }
}
